package com.king.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.king.controller.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author KING
 * @since 2020-09-01
 */
@Controller
@RequestMapping("/category")
public class MCategoryController extends BaseController {

    /**
     * 获取分类信息
     * @param id
     * @return
     */
    @GetMapping("/{id:\\d*}")//【:\d*】过滤掉类似category/add等
    public String catetory(@PathVariable(name = "id") Long id){
        request.setAttribute("currentCategoryId",id);

        int pageNum = ServletRequestUtils.getIntParameter(request,"pn",1);
        request.setAttribute("pn",pageNum);
        return "post/category";
    }
}
